<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="app"></div>
</body>
<script>
    // 生命周期函数   在某一时刻会自动执行的函数
    const app = Vue.createApp({//application 创建一个Vue应用
        data() {
            return {
                message:'hello world!',
                count:5
            }
        },
        methods: {
            handleitemclick(){
                this.message = this.message=='hello world!'?'你好世界':'hello world!'
            }
        },
        template: `<h2 @click="handleitemclick" v-html="message" v-once></h2>
                    <h2 v-bind:title="message">{{message}}</h2>
                    <h2>{{count>2?1:2}}</h2>
                    <h2>{{1+5}}</h2>
        `

    })
    const vm = app.mount("#app")//挂载这个Vue应用
</script>

</html>